package crm.view.leeds;

import java.awt.event.ActionListener;

import javax.swing.JPanel;
import javax.swing.SpringLayout;
import javax.swing.JSeparator;
import javax.swing.JLabel;
import javax.swing.JTextField;
import javax.swing.JTextArea;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.table.DefaultTableModel;
import javax.swing.JComboBox;
import javax.swing.JButton;
import java.awt.Dimension;
import javax.swing.DefaultComboBoxModel;
import javax.swing.border.LineBorder;

import org.jdesktop.swingx.autocomplete.AutoCompleteDecorator;
import java.awt.Color;
import java.awt.Font;
import java.awt.TextField;


public class FollowupActionsView extends JPanel
{
	private JComboBox tNewFollowup;
	private JTextArea textAreaResult;
	private JTable table;
	private JComboBox comboLeadPriority;
	private JButton btnSave_1;
	private JButton btnSave;
	private JButton btnAdd;
	private JButton btnSendSms;
	private JButton btnSendEmail;
	private JComboBox comboStatus;
	private JComboBox comboAttended;
	private JTextField lblClick;
	private JScrollPane scrollPane;
	private JButton btnCl;
	private JLabel lblLeadName;
	private JLabel tfDate;
	private JLabel lblleadNo;
	private JLabel lblregDate;
	
	private JLabel lblLeadSatatus;
	private JLabel lblLeadPriority;
	private JTextField tfleadStatus;
	private JTextField tfLeadPriority;
	private JComboBox tfLeadName;
	private JLabel lblLeadNo1;
	
	public FollowupActionsView() 
	{
		setFont(new Font("MS Reference Sans Serif", Font.PLAIN, 13));
		setBackground(Color.ORANGE);
		SpringLayout springLayout = new SpringLayout();
		setLayout(springLayout);
		
		lblLeadName = new JLabel("Name:");
		lblLeadName.setFont(new Font("MS Reference Sans Serif", Font.PLAIN, 13));
		springLayout.putConstraint(SpringLayout.NORTH, lblLeadName, 30, SpringLayout.NORTH, this);
		springLayout.putConstraint(SpringLayout.WEST, lblLeadName, 30, SpringLayout.WEST, this);
		add(lblLeadName);
		
		tfLeadName = new JComboBox();
		tfLeadName.setPreferredSize(new Dimension(200, 23));
		tfLeadName.setFont(new Font("Microsoft Sans Serif", Font.PLAIN, 13));
		springLayout.putConstraint(SpringLayout.WEST, tfLeadName, 30, SpringLayout.WEST,this);
		springLayout.putConstraint(SpringLayout.NORTH, tfLeadName, 6, SpringLayout.SOUTH,lblLeadName);
		add(tfLeadName);
		
		lblLeadNo1 = new JLabel("Lead No :");
		lblLeadNo1.setFont(new Font("MS Reference Sans Serif", Font.PLAIN, 13));
		springLayout.putConstraint(SpringLayout.NORTH, lblLeadNo1, 0, SpringLayout.NORTH, lblLeadName);
		springLayout.putConstraint(SpringLayout.WEST, lblLeadNo1, 50, SpringLayout.EAST,tfLeadName);
		add(lblLeadNo1);
		
		lblleadNo = new JLabel("XYZ");
		springLayout.putConstraint(SpringLayout.NORTH, lblleadNo, 6, SpringLayout.SOUTH, lblLeadName);
		springLayout.putConstraint(SpringLayout.WEST, lblleadNo, 0, SpringLayout.WEST, lblLeadNo1);
		lblleadNo.setFont(new Font("MS Reference Sans Serif", Font.PLAIN, 13));
		add(lblleadNo);
		
		JLabel leadRegisteredDate = new JLabel("Registration Date: ");
		springLayout.putConstraint(SpringLayout.NORTH, leadRegisteredDate, 0, SpringLayout.NORTH, lblLeadName);
		springLayout.putConstraint(SpringLayout.WEST, leadRegisteredDate, 50, SpringLayout.EAST, lblLeadNo1);
		leadRegisteredDate.setFont(new Font("MS Reference Sans Serif", Font.PLAIN, 13));
		add(leadRegisteredDate);
		
		lblregDate = new JLabel("MM/DD/YYYY");
		springLayout.putConstraint(SpringLayout.NORTH, lblregDate, 6, SpringLayout.SOUTH, leadRegisteredDate);
		springLayout.putConstraint(SpringLayout.WEST, lblregDate, 0, SpringLayout.WEST, leadRegisteredDate);
		lblregDate.setFont(new Font("MS Reference Sans Serif", Font.PLAIN, 13));
		add(lblregDate);
		
		lblLeadSatatus = new JLabel("Lead Satatus :");
		lblLeadSatatus.setFont(new Font("MS Reference Sans Serif", Font.PLAIN, 13));
		springLayout.putConstraint(SpringLayout.NORTH, lblLeadSatatus, 0, SpringLayout.NORTH, lblLeadName);
		springLayout.putConstraint(SpringLayout.WEST, lblLeadSatatus, 50, SpringLayout.EAST,leadRegisteredDate);
		add(lblLeadSatatus);
		
		tfleadStatus = new JTextField();
		tfleadStatus.setFont(new Font("MS Reference Sans Serif", Font.PLAIN, 13));
		springLayout.putConstraint(SpringLayout.NORTH, tfleadStatus, 0, SpringLayout.NORTH, lblLeadName);
		springLayout.putConstraint(SpringLayout.WEST, tfleadStatus, 10, SpringLayout.EAST, lblLeadSatatus);
		add(tfleadStatus);
		tfleadStatus.setColumns(15);
		
		lblLeadPriority = new JLabel("Lead Priority:");
		lblLeadPriority.setFont(new Font("MS Reference Sans Serif", Font.PLAIN, 13));
		springLayout.putConstraint(SpringLayout.NORTH, lblLeadPriority, 6, SpringLayout.SOUTH, lblLeadSatatus);
		springLayout.putConstraint(SpringLayout.WEST, lblLeadPriority, 0, SpringLayout.WEST, lblLeadSatatus);
		add(lblLeadPriority);
		
		tfLeadPriority = new JTextField();
		tfLeadPriority.setFont(new Font("MS Reference Sans Serif", Font.PLAIN, 13));
		springLayout.putConstraint(SpringLayout.NORTH, tfLeadPriority, 6, SpringLayout.SOUTH, tfleadStatus);
		springLayout.putConstraint(SpringLayout.WEST, tfLeadPriority, 0, SpringLayout.WEST,tfleadStatus);
		add(tfLeadPriority);
		tfLeadPriority.setColumns(15);
		
		btnCl = new JButton("Cl");
		btnCl.setFont(new Font("MS Reference Sans Serif", Font.PLAIN, 13));
		springLayout.putConstraint(SpringLayout.NORTH, btnCl, 0, SpringLayout.NORTH,tfLeadPriority);
		springLayout.putConstraint(SpringLayout.EAST, btnCl, -30, SpringLayout.EAST, this);
		add(btnCl);
		
		lblClick = new JTextField("");
		springLayout.putConstraint(SpringLayout.EAST, lblClick, -10, SpringLayout.WEST, btnCl);
		springLayout.putConstraint(SpringLayout.NORTH, lblClick, 0, SpringLayout.NORTH, btnCl);
		lblClick.setEditable(false);
		lblClick.setColumns(10);
		lblClick.setFont(new Font("MS Reference Sans Serif", Font.PLAIN, 13));
		add(lblClick);
		
		tfDate = new JLabel("Date :");
		springLayout.putConstraint(SpringLayout.NORTH, tfDate, 0, SpringLayout.NORTH, lblLeadName);
		springLayout.putConstraint(SpringLayout.WEST, tfDate, 0, SpringLayout.WEST, lblClick);
		tfDate.setFont(new Font("MS Reference Sans Serif", Font.PLAIN, 13));
		add(tfDate);
		
		JLabel lblChangePriority = new JLabel("Change Lead Priority");
		lblChangePriority.setFont(new Font("MS Reference Sans Serif", Font.PLAIN, 13));
		springLayout.putConstraint(SpringLayout.NORTH, lblChangePriority, 30, SpringLayout.SOUTH,tfLeadName);
		springLayout.putConstraint(SpringLayout.WEST, lblChangePriority, 30, SpringLayout.WEST, this);
		add(lblChangePriority);
		
		comboLeadPriority = new JComboBox();
		comboLeadPriority.setFont(new Font("MS Reference Sans Serif", Font.PLAIN, 13));
		comboLeadPriority.setModel(new DefaultComboBoxModel(new String[] {"--Select Priority--"}));
		comboLeadPriority.setPreferredSize(new Dimension(200, 23));
		springLayout.putConstraint(SpringLayout.NORTH, comboLeadPriority, 6, SpringLayout.SOUTH,lblChangePriority);
		springLayout.putConstraint(SpringLayout.WEST, comboLeadPriority, 30, SpringLayout.WEST,this);
		add(comboLeadPriority);
		
		btnSave_1 = new JButton("Save");
		btnSave_1.setFont(new Font("MS Reference Sans Serif", Font.PLAIN, 13));
		springLayout.putConstraint(SpringLayout.NORTH, btnSave_1, 0, SpringLayout.NORTH, comboLeadPriority);
		springLayout.putConstraint(SpringLayout.WEST, btnSave_1, 10, SpringLayout.EAST,comboLeadPriority);
		add(btnSave_1);
		btnSave_1.setActionCommand("Save");
		
		comboStatus = new JComboBox();
		comboStatus.setFont(new Font("MS Reference Sans Serif", Font.PLAIN, 13));
		comboStatus.setModel(new DefaultComboBoxModel(new String[] {"--Select Status--"}));
		comboStatus.setPreferredSize(new Dimension(200, 23));
		springLayout.putConstraint(SpringLayout.NORTH, comboStatus, 0, SpringLayout.NORTH,btnSave_1);
		springLayout.putConstraint(SpringLayout.WEST, comboStatus, 50, SpringLayout.EAST,btnSave_1);
		add(comboStatus);
		
		btnSave = new JButton("Save");
		btnSave.setFont(new Font("MS Reference Sans Serif", Font.PLAIN, 13));
		springLayout.putConstraint(SpringLayout.NORTH, btnSave, 0, SpringLayout.NORTH, comboStatus);
		springLayout.putConstraint(SpringLayout.WEST, btnSave, 10, SpringLayout.EAST, comboStatus);
		add(btnSave);
		btnSave.setActionCommand("Save");
		
		JLabel lblChangeStatus = new JLabel("Change Status");
		lblChangeStatus.setFont(new Font("MS Reference Sans Serif", Font.PLAIN, 13));
		springLayout.putConstraint(SpringLayout.NORTH, lblChangeStatus, 0, SpringLayout.NORTH, lblChangePriority);
		springLayout.putConstraint(SpringLayout.WEST, lblChangeStatus, 0, SpringLayout.WEST,comboStatus);
		add(lblChangeStatus);
		
		btnSendSms = new JButton("Send SMS");
		springLayout.putConstraint(SpringLayout.EAST, btnCl, 0, SpringLayout.EAST, btnSendSms);
		btnSendSms.setFont(new Font("MS Reference Sans Serif", Font.PLAIN, 13));
		springLayout.putConstraint(SpringLayout.NORTH, btnSendSms, 0, SpringLayout.NORTH,btnSave);
		springLayout.putConstraint(SpringLayout.EAST, btnSendSms, -30, SpringLayout.EAST, this);
		add(btnSendSms);
		btnSendSms.setActionCommand("Send SMS");
		
		btnSendEmail = new JButton("Send Email");
		btnSendEmail.setFont(new Font("MS Reference Sans Serif", Font.PLAIN, 13));
		springLayout.putConstraint(SpringLayout.EAST, btnSendEmail, -20, SpringLayout.WEST, btnSendSms);
		springLayout.putConstraint(SpringLayout.NORTH, btnSendEmail, 0, SpringLayout.NORTH, btnSendSms);
		add(btnSendEmail);
		btnSendEmail.setActionCommand("Send Email");
		
		JSeparator separator = new JSeparator();
		springLayout.putConstraint(SpringLayout.NORTH, separator, 30, SpringLayout.SOUTH,comboLeadPriority);
		springLayout.putConstraint(SpringLayout.WEST, separator, 30, SpringLayout.WEST, this);
		springLayout.putConstraint(SpringLayout.EAST, separator, -30, SpringLayout.EAST, this);
		add(separator);
		
		//*****************************************************************************
		tNewFollowup = new JComboBox();
		tNewFollowup.setFont(new Font("MS Reference Sans Serif", Font.PLAIN, 13));
		tNewFollowup.setModel(new DefaultComboBoxModel(new String[] {"--Select Followup Action--"}));
		tNewFollowup.setPreferredSize(new Dimension(200, 23));
		springLayout.putConstraint(SpringLayout.SOUTH, tNewFollowup, -30, SpringLayout.SOUTH,this);
		springLayout.putConstraint(SpringLayout.WEST, tNewFollowup, 30, SpringLayout.WEST,this);
		add(tNewFollowup);
		
		JLabel lblNewFollowupAction = new JLabel("New Followup Action");
		lblNewFollowupAction.setFont(new Font("MS Reference Sans Serif", Font.PLAIN, 13));
		springLayout.putConstraint(SpringLayout.SOUTH, lblNewFollowupAction,-6, SpringLayout.NORTH,tNewFollowup);
		springLayout.putConstraint(SpringLayout.WEST, lblNewFollowupAction, 30, SpringLayout.WEST, this);
		add(lblNewFollowupAction);
		
		scrollPane = new JScrollPane();
		scrollPane.setFont(new Font("MS Reference Sans Serif", Font.PLAIN, 13));
		springLayout.putConstraint(SpringLayout.NORTH, scrollPane, 30, SpringLayout.SOUTH,separator);
		springLayout.putConstraint(SpringLayout.SOUTH, scrollPane, -30, SpringLayout.SOUTH,lblNewFollowupAction);
		springLayout.putConstraint(SpringLayout.WEST, scrollPane, 30, SpringLayout.WEST, this);
		springLayout.putConstraint(SpringLayout.EAST, scrollPane, -30, SpringLayout.EAST, this);
		add(scrollPane);
		
		table = new JTable();
		table.setFont(new Font("MS Reference Sans Serif", Font.PLAIN, 12));
		table.setModel(new DefaultTableModel(
			new Object[][] {
			},
			new String[] {
				"Followup Action Name", "AttendedBy", "Date", "Comments"
			}
		) {
			boolean[] columnEditables = new boolean[] {
				false, false, false, true
			};
			public boolean isCellEditable(int row, int column) {
				return columnEditables[column];
			}
		});
		scrollPane.setViewportView(table);
		
		JLabel lblAttendedBy = new JLabel("Attended By");
		lblAttendedBy.setFont(new Font("MS Reference Sans Serif", Font.PLAIN, 13));
		springLayout.putConstraint(SpringLayout.NORTH, lblAttendedBy, 0, SpringLayout.NORTH, lblNewFollowupAction);
		springLayout.putConstraint(SpringLayout.WEST, lblAttendedBy, 30, SpringLayout.EAST, tNewFollowup);
		add(lblAttendedBy);
		
		comboAttended = new JComboBox();
		comboAttended.setFont(new Font("MS Reference Sans Serif", Font.PLAIN, 13));
		comboAttended.setModel(new DefaultComboBoxModel(new String[] {"--Select Attended By--"}));
		comboAttended.setPreferredSize(new Dimension(220, 23));
		springLayout.putConstraint(SpringLayout.SOUTH, comboAttended, -30, SpringLayout.SOUTH,this);
		springLayout.putConstraint(SpringLayout.WEST, comboAttended, 0, SpringLayout.WEST, lblAttendedBy);
		add(comboAttended);
		
		JLabel lblComment = new JLabel("Comment");
		lblComment.setFont(new Font("MS Reference Sans Serif", Font.PLAIN, 13));
		springLayout.putConstraint(SpringLayout.NORTH, lblComment, 0, SpringLayout.NORTH, lblNewFollowupAction);
		springLayout.putConstraint(SpringLayout.WEST, lblComment, 30, SpringLayout.EAST,comboAttended);
		add(lblComment);
		
		btnAdd = new JButton("Add");
		btnAdd.setFont(new Font("MS Reference Sans Serif", Font.PLAIN, 13));
		springLayout.putConstraint(SpringLayout.EAST, btnAdd, -30, SpringLayout.EAST,this );
		springLayout.putConstraint(SpringLayout.NORTH, btnAdd, 0, SpringLayout.NORTH,comboAttended);
		add(btnAdd);
		
		textAreaResult = new JTextArea();
		textAreaResult.setFont(new Font("MS Reference Sans Serif", Font.PLAIN, 13));
		textAreaResult.setBorder(new LineBorder(new Color(0, 0, 0)));
		textAreaResult.setPreferredSize(new Dimension(300, 23));
		springLayout.putConstraint(SpringLayout.NORTH, textAreaResult, 0, SpringLayout.NORTH,comboAttended);
		springLayout.putConstraint(SpringLayout.WEST, textAreaResult, 0, SpringLayout.WEST,lblComment);
		springLayout.putConstraint(SpringLayout.EAST, textAreaResult, -30, SpringLayout.WEST,btnAdd);
		add(textAreaResult);
		
	}
	
	public JTextField getTfleadStatus() {
		return tfleadStatus;
	}

	public void setTfleadStatus(JTextField tfleadStatus) {
		this.tfleadStatus = tfleadStatus;
	}

	public JTextField getTfLeadPriority() {
		return tfLeadPriority;
	}

	public void setTfLeadPriority(JTextField tfLeadPriority) {
		this.tfLeadPriority = tfLeadPriority;
	}

	public JTextArea getTextAreaResult() {
		return textAreaResult;
	}
	public void setTextAreaResult(JTextArea textAreaResult) {
		this.textAreaResult = textAreaResult;
	}
	public JTable getTable() {
		return table;
	}
	public void setTable(JTable table) {
		this.table = table;
	}

	public JComboBox getComboLeadPriority() {
		return comboLeadPriority;
	}

	public void setComboLeadPriority(JComboBox comboLeadPriority) {
		this.comboLeadPriority = comboLeadPriority;
	}

	public JButton getBtnSave_1() {
		return btnSave_1;
	}

	public void setBtnSave_1(JButton btnSave_1) {
		this.btnSave_1 = btnSave_1;
	}

	public JButton getBtnSave() {
		return btnSave;
	}

	public void setBtnSave(JButton btnSave) {
		this.btnSave = btnSave;
	}

	public JButton getBtnAdd() {
		return btnAdd;
	}

	public void setBtnAdd(JButton btnAdd) {
		this.btnAdd = btnAdd;
	}

	public JButton getBtnSendSms() {
		return btnSendSms;
	}

	public void setBtnSendSms(JButton btnSendSms) {
		this.btnSendSms = btnSendSms;
	}

	public JButton getBtnSendEmail() {
		return btnSendEmail;
	}

	public void setBtnSendEmail(JButton btnSendEmail) {
		this.btnSendEmail = btnSendEmail;
	}

	public JComboBox getComboStatus() {
		return comboStatus;
	}

	public void setComboStatus(JComboBox comboStatus) {
		this.comboStatus = comboStatus;
	}

	public JComboBox getComboAttended() {
		return comboAttended;
	}

	public void setComboAttended(JComboBox comboAttended) {
		this.comboAttended = comboAttended;
	}

	public JTextField getLblClick() {
		return lblClick;
	}

	public void setLblClick(JTextField lblClick) {
		this.lblClick = lblClick;
	}

	public JLabel getTfDate() {
		return tfDate;
	}

	public void setTfDate(JLabel tfDate) {
		this.tfDate = tfDate;
	}

	public JComboBox getTfLeadName() {
		return tfLeadName;
	}

	public JComboBox gettNewFollowup() {
		return tNewFollowup;
	}

	public void settNewFollowup(JComboBox tNewFollowup) {
		this.tNewFollowup = tNewFollowup;
	}

	public JScrollPane getScrollPane() {
		return scrollPane;
	}

	public void setScrollPane(JScrollPane scrollPane) {
		this.scrollPane = scrollPane;
	}

	public JButton getBtnCl() {
		return btnCl;
	}

	public void setBtnCl(JButton btnCl) {
		this.btnCl = btnCl;
	}
	
	public JLabel getLblLeadName() {
		return lblLeadName;
	}

	public void setLblLeadName(JLabel lblLeadName) {
		this.lblLeadName = lblLeadName;
	}

	public JLabel getLblregDate() {
		return lblregDate;
	}

	public void setLblregDate(JLabel lblregDate) {
		this.lblregDate = lblregDate;
	}

	public JLabel getLblleadNo() {
		return lblleadNo;
	}

	public void setLblleadNo(JLabel lblleadNo) {
		this.lblleadNo = lblleadNo;
	}

	public void actionListener(ActionListener al)
	{
		btnSave_1.addActionListener(al);
		btnSave.addActionListener(al);
		btnAdd.addActionListener(al);
		btnSendEmail.addActionListener(al);
		btnSendSms.addActionListener(al);
		btnCl.addActionListener(al);
	}
}
